package com.yong.android.framework.utils;

import io.reactivex.disposables.Disposable;

/**
 * Description:
 * Created by yong
 */

public class DisposableUtils {

    public static boolean isDisposable(Disposable d) {
        return d == null || d.isDisposed();
    }

    /**
     * @param d
     */
    public static void dispose(Disposable d) {
        if (!isDisposable(d)) {
            d.dispose();
        }
    }

    public static void cancelCountDownTimer(CompatCountDownTimer timer){
        if (timer!=null){
            timer.cancel();
        }
    }

}
